Flash memory devices are convenient electronic memory devices used in a wide variety of applications. A flash memory device offers non-volatile storage of data, and also allows the data to be programmed into the memory and erased from the memory multiple times, thus enabling a multitude of flexible applications and uses.
Recent flash memory devices include an embedded method or algorithm to execute all modify operations of the flash memory, implemented by code stored in a read-only memory (ROM) and executed by a microcontroller. The modify operations include such operations as programming the flash memory with data, erasing data from the flash memory, etc. Some of the modify operations require long execution times due to the physical structure of the flash memory cells and due to the organization of the cell array. For these reasons, a feature required in flash memory devices is suspension of the longer modify operations, such as program or erase, for a particular length of time to allow a user to immediately access the flash memory. For example, when the user needs to read some array locations in the flash memory while one of the long modify operations is going on, the user can issue a suspend request (command) to the flash memory via a command interface, such as an input/output (I/O) pad of the flash memory.
The suspend command is decoded by the command interface (microcontroller) and, when the suspension of the modify operation is completed within a predetermined amount of time, the flash memory is allowed to be accessed for the read operations needed by the user (or another modify operation can be performed for the user). After the user's operations are complete, a resume command causes the interrupted modify operation to resume at the point where it was suspended, and to terminate correctly as appropriate for that operation.
In typical flash memories, a user's suspend request is managed in a software mode, i.e., using software code that the embedded method or algorithm can implement. In most flash memory implementations, when a suspend request occurs during a modify operation, a flag in a register is set. The embedded software code, using query instructions, checks if a suspend request has been issued from the user by checking or testing that register. After a query, if the register flag indicates that a suspend request has been issued, the embedded software code requests a jump to a particular code sequence that is a suspend sequence. The suspend sequence suspends the modify operation by switching off all charge pumps and high voltages used for running the modify operation and saves the configuration (such as state variables and timing parameters) that are used when the modify operation is resumed.
The software query of the flag described above must be executed periodically to check the register and determine whether a suspend request has occurred. The number of queries, i.e. the amount of time between queries, can be determined based on a predefined time characteristic for the flash memory, called “time to suspend.” This is the maximum amount of time allowed from a suspend request to the completion of the suspension (interruption of the modify operation), after which the user's access is allowed. To comply with the time to suspend, a query needs to be executed in software code at a minimum rate. This requires a minimum number of query code instructions (compare operations) to be included in the embedded code, as well as an equivalent number of jump instructions (or similar instructions) that cause the code to jump to the branch of code storing the suspend sequence if the register flag is found to have been set.
Thus, the timing period between any two queries must guarantee that the time to suspend is met, requiring a relatively high number of query instructions. Furthermore, this number of instructions increases with an increase in complexity and length of the embedded software code. State-of-the-art flash memories have a high complexity in which the embedded code must execute several types of operations and features, including factory programs, enhanced factory programs, non-volatile protection of sectors, etc.; and multi-level flash memory devices require additional complex algorithms. It is important to be able to implement such features without increasing the length of the embedded code in an excessive way and to respect the required timing of the device. Thus, it is important to optimize and reduce as much as possible the embedded code length stored in the ROM or SRAM of the flash device so as to improve area efficiency, and, more importantly, to reduce the time duration required to execute code so that the timing requirements may be respected. For example, if the embedded code executes query instructions for 1,000 times during a modify operation, and the clock of the microcontroller executing the instructions is 100 nanoseconds, then 10 microseconds of extra time is expended simply for executing the queries. This drawback is even more evident in multi-level flash devices in which multiple bits can be stored in each cell, where the embedded code executes a very high number of repetitive instruction sequences. Adding new lines and features to the embedded code must necessarily increase the number of query instructions, since the time between queries must be such that the time to suspend of the device is followed.
Accordingly, what is needed is an apparatus or method for managing of a suspend request in a flash memory device without increasing the time duration needed to execute the embedded code and reducing the code length and the amount of storage needed for the code. The present invention addresses such a need.